package com.ruoyi.project.jiaqin.supplyimg.service.impl;

import com.ruoyi.common.utils.text.Convert;
import com.ruoyi.project.jiaqin.supplyimg.domain.SupplyImg;
import com.ruoyi.project.jiaqin.supplyimg.mapper.SupplyImgMapper;
import com.ruoyi.project.jiaqin.supplyimg.service.ISupplyImgService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;
import java.util.UUID;

/**
 * 供应轮播图片Service业务层处理
 *
 * @author LCL
 * @date 2021-11-17
 */
@Service
public class SupplyImgServiceImpl implements ISupplyImgService
{
    @Autowired
    private SupplyImgMapper supplyImgMapper;

    /**
     * 查询供应轮播图片
     *
     * @param id 供应轮播图片ID
     * @return 供应轮播图片
     */
    @Override
    public SupplyImg selectSupplyImgById(String id)
    {
        return supplyImgMapper.selectSupplyImgById(id);
    }

    /**
     * 查询供应轮播图片列表
     *
     * @param supplyImg 供应轮播图片
     * @return 供应轮播图片
     */
    @Override
    public List<SupplyImg> selectSupplyImgList(SupplyImg supplyImg)
    {
        return supplyImgMapper.selectSupplyImgList(supplyImg);
    }

    /**
     * 新增供应轮播图片
     *
     * @param supplyImg 供应轮播图片
     * @return 结果
     */
    @Override
    public int insertSupplyImg(SupplyImg supplyImg)
    {
        supplyImg.setId(UUID.randomUUID().toString().replace("-",""));
        supplyImg.setCreatedTime(new Date());
        return supplyImgMapper.insertSupplyImg(supplyImg);
    }

    /**
     * 修改供应轮播图片
     *
     * @param supplyImg 供应轮播图片
     * @return 结果
     */
    @Override
    public int updateSupplyImg(SupplyImg supplyImg)
    {
        return supplyImgMapper.updateSupplyImg(supplyImg);
    }

    /**
     * 删除供应轮播图片对象
     *
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteSupplyImgByIds(String ids)
    {
        return supplyImgMapper.deleteSupplyImgByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除供应轮播图片信息
     *
     * @param id 供应轮播图片ID
     * @return 结果
     */
    @Override
    public int deleteSupplyImgById(String id)
    {
        return supplyImgMapper.deleteSupplyImgById(id);
    }
}
